package cn.buk.tms.eotms.entity;

import java.util.Date;
import jakarta.persistence.*;

/**
 * 增值服务产品
 *
 * @author yfdai
 * @date 2017/5/30
 */
@Entity
@Table(name = "tie_in_product", uniqueConstraints = @UniqueConstraint(name = "uk_tie_in_product", columnNames = {"enterprise_id", "product_code"}))
public class TieInProduct {

    /**
     * 保险
     */
    public static final int INSURANCE = 0;

    /**
     * 行程单
     */
    public static final int ITINERARY = 1;

    /**
     * vip通道
     */
    public static final int VIP = 2;

    /**
     * 选座
     */
    public static final int SEAT_CHOICE = 3;

    /**
     * 租车服务
     */
    public static final int CAR_RENT = 4;

    /**
     * 额外行李
     */
    public static final int LUGGAGE_EXTRA = 5;

    /**
     * 其它增值服务
     */
    public static final int VAS_OT = 9;

    /**
     * 第三方的服务产品（目前指通过VAAS API的）
     */
    public static final int THIRD_VAS_PRODUCT = 99;

    @Id
    @GeneratedValue
    private int id;

    @Column(name = "enterprise_id", updatable = false)
    private int enterpriseId;

    /**
     * 10开头表示保险
     * 商品代码
     */
    @Column(name = "product_code", length = 10, updatable = false)
    private String productCode;

    /**
     * 0 - 保险
     * 商品类型： 保险，门票等
     */
    @Column(name = "product_type", updatable = false)
    private int productType;

    /**
     * 商品名称：航意险，延误险等
     */
    @Column(name = "product_name", length = 50)
    private String productName;

    /**
     * 产品描述
     */
    @Column(name = "product_desc", length = 50)
    private String productDesc;

    /**
     * 价格
     */
    private int price;

    /**
     * 折扣金额
     */
    private int discount;

    /**
     * 成本
     */
    private Double cost;

    /**
     * 是否启用
     * 1-启用
     * 0-不启用
     */
    private int status = 1;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", insertable = false, updatable = false)
    private Date createTime;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "lastupdate", insertable = false)
    private Date lastUpdate;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getEnterpriseId() {
        return enterpriseId;
    }

    public void setEnterpriseId(int enterpriseId) {
        this.enterpriseId = enterpriseId;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    public int getProductType() {
        return productType;
    }

    public void setProductType(int productType) {
        this.productType = productType;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getProductDesc() {
        return productDesc;
    }

    public void setProductDesc(String productDesc) {
        this.productDesc = productDesc;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public int getDiscount() {
        return discount;
    }

    public void setDiscount(int discount) {
        this.discount = discount;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Date getLastUpdate() {
        return lastUpdate;
    }

    public void setLastUpdate(Date lastUpdate) {
        this.lastUpdate = lastUpdate;
    }

    public double getCost() {
        return cost == null ? 0 : cost;
    }

    public void setCost(double cost) {
        this.cost = cost;
    }
}
